
import axios from "../utils/axios"


const getTarget=async (page:number,limit:number,nname:string,ncomparison:string)=>{
    const data=await axios({
        url:'norm/list',
        method:'post',
        data: {
            page: page,
            limit: limit,
            nname: nname,
            ncomparison:ncomparison
            
        }
    })
    
    return data;
}

//添加
const addTarget = async (_data: {
    nid: Number;
      ncode: string;
    nname: string,
    nunit: string;
    nceiling: string;
    nfloor: string;
    nnormalPrompt: string;
    nhighPrompt: string;
    nlowPrompt: string;
}) => {
    const data = await axios({
        url: 'norm/add',
        method: 'post',
         data:_data
    })
     return data;
}
// 编辑
const editTarget = async (_data: {
    nid: Number;
    ncode: string;
    nname: string,
    nunit: string;
    nceiling: string;
    nfloor: string;
    nnormalPrompt: string;
    nhighPrompt: string;
    nlowPrompt: string;

}) => {
    const data = await axios({
        url: 'norm/update',
        method: 'post',
         data:_data
    })
     return data;
}
const editDate = async (nid: number) => {
    const data = await axios({
        url:'/norm/' + nid +''
    })
    return data
}
//删除
const deleteTarget = async (nid: number) => {
    const data = await axios({
        url: 'norm/delete',
        method: "get",
        params: {
            id:nid
        }
    })
        return data;
};
// 批量删除
const detrStarget = async (ids:number[]) => {
    const data = await axios({
         url: 'norm/deleteByIds',
        method: "post",
        data: {
            ids:ids
        }
    })
     return data;
}


export {
    getTarget,
    addTarget,
    editTarget,
    deleteTarget,
    detrStarget,
    editDate
   
}
